<?php
/**
 * PageController
 *
 * @author 王志昂
 * @version
 */
class PageController extends Controller_Helper
{
    public function indexAction()
    {
    	$validator = new Zend_Validate_Int();
        $articleId = (int)$this->_request->getParam('p');
        $articleObj = new Business_Article();
        if (empty($articleId) || !$validator->isValid($articleId)) {
            $this->_redirect('/error.html');
        }
        $articleDetail = $articleObj->getArticleDetails($articleId);
        if (empty($articleDetail)) {
            $this->_redirect('/error.html');
        }
        $this->view->articleDetail = $articleDetail;
        $articleTableInfo = Zend_Registry::get('database')->article;
        $this->view->title = $articleDetail[$articleTableInfo->title];
        $this->view->description = $articleDetail[$articleTableInfo->description];
        $this->view->keywords = $articleDetail[$articleTableInfo->keywords];
    }
}
